'''环境配置'''
import gym
import numpy as np
import db


class Env(gym.Env):

    # 初始化
    def __init__(self):
        self.students = db.init_students();
        self.teachers = db.init_teachers();
        self.teaching_assignment = db.init_teaching_assignment();
        # 初始化状态空间
        self.state_space = np.zeros((len(self.students) + len(self.teachers) + 1, 35 + len(self.teaching_assignment)));
        # 初始化动作空间
        self.action_space = np.array([1, -1]);
        # 初始化奖励函数
        self.reward_range = [-100, 100];
        self.reward_function = 0;
        # 初始化课表
        self.start_timetable = np.zeros(5, 7);
        # 状态空间和动作空间大小
        self.state_size = len(self.state_space);
        self.action_size = len(self.action_space);

    # 状态s下选择动作到s+1
    def step(self, action):
        next_state, value, done = self.takeAction(action);
        self.state_space = next_state;

        return next_state, value, done;

    # 选择动作
    def takeAction(self, action):
        value = 0
        done = 0

        pass

    # 重置状态
    def reset(self):
        self.action_space = np.zeros((len(self.students) + len(self.teachers) + 1, 35 + len(self.teaching_assignment)));
        return self.action_space

    # 奖励函数
    def reward(self):
        pass

    # 可视化渲染
    def render(self):
        pass

    # 关闭环境
    def close(self):
        pass
